package com.hyst.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.hyst.model.PersonProducePlanTrendView;

public interface Person_Produce_Plan_Trend_Repository extends JpaRepository<PersonProducePlanTrendView, String> {

	@Query(value = "SELECT id, count(DATE_FORMAT(plan_begin_time,'%Y-%m-%d')) as plan_task_count, sum(plan_count) as plan_output_count, sum(plan_hours) as plan_hour,DATE_FORMAT(plan_begin_time,'%Y-%m-%d') as plan_begin_time FROM workshop_plan  where worker_id=?1  and plan_begin_time >=?2  and plan_finish_time <=?3 GROUP BY DATE_FORMAT(plan_begin_time,'%Y-%m-%d'),id,plan_begin_time  ", nativeQuery = true)
	List<PersonProducePlanTrendView> findAllByUserID(String worker_id, String starttime, String endtime);
}
